package weaver.interfaces.zhlx.duss.action.hrmresourcemodule.hcm;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.general.BaseBean;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.zhlx.duss.utils.HcmUtil;
import weaver.soa.workflow.request.RequestInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: ecology-idea
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2023-12-07
 * @Description: 员工信息自助完善流程调用接口员工信息修改接口
 * @ModifyLog:
 **/
public class WeaYgxxzzwslcAction extends BaseBean implements Action {
    @Override
    public String execute(RequestInfo requestInfo) {
        String requestid = requestInfo.getRequestid();
        String tablename = requestInfo.getRequestManager().getBillTableName();
        String src = requestInfo.getRequestManager().getSrc();
        writeLog(">>>>>WeaYgxxzzwslcAction>>>>>requestid=" + requestid);
        try {
            String message = "调用HCM系统接口返回:";
            RecordSet rs = new RecordSet();
            HcmUtil hcmUtil = new HcmUtil();
            rs.executeQuery("select * from " + tablename + " where requestid=?", requestid);
            rs.next();
            String mainid = Util.null2String(rs.getString("id"));
            String dbdwsj = hcmUtil.formatDate(Util.null2String(rs.getString("dbdwsj")));
            String gh = hcmUtil.formatDate(Util.null2String(rs.getString("gh")));
            String x = Util.null2String(rs.getString("x"));
            String m = Util.null2String(rs.getString("m"));
            String xb = Util.null2String(rs.getString("xb"));
            String csrq = Util.null2String(rs.getString("csrq"));
            String gjbm = Util.null2String(rs.getString("gjbm"));
            String hyzk = Util.null2String(rs.getString("hyzk"));
            String hkxz = Util.null2String(rs.getString("hkxz"));
            String mz = Util.null2String(rs.getString("mz"));
            String jg = Util.null2String(rs.getString("jg"));
            String csd = Util.null2String(rs.getString("csd"));
            String jkzk = Util.null2String(rs.getString("jkzk"));
            String rsdaszd = Util.null2String(rs.getString("rsdaszd"));
            String sccbsj =Util.null2String(rs.getString("sccbsj"));
            String rzhtxsj = Util.null2String(rs.getString("rzhtxsj"));
            String sjhm1 = Util.null2String(rs.getString("sjhm1"));
            String sjhm2 = Util.null2String(rs.getString("sjhm2"));
            String dzyx = Util.null2String(rs.getString("dzyx"));
            String guid1 = Util.null2String(rs.getString("guid1"));
            String guid2 = Util.null2String(rs.getString("guid2"));
            String guid3 = Util.null2String(rs.getString("guid3"));
            String guid4 = Util.null2String(rs.getString("guid4"));
            String guid5 = Util.null2String(rs.getString("guid5"));
            String guid7 = Util.null2String(rs.getString("guid7"));
            String guid8 = Util.null2String(rs.getString("guid8"));
            String guid9 = Util.null2String(rs.getString("guid9"));
            String guid12 = Util.null2String(rs.getString("guid12"));
            String guid13 = Util.null2String(rs.getString("guid13"));
            String guid14 = Util.null2String(rs.getString("guid14"));
            String guid15 = Util.null2String(rs.getString("guid15"));
            String zhdxzhzt = Util.null2String(rs.getString("zhdxzhzt"));
            JSONArray xgDataList = new JSONArray();
            JSONObject xgDataJson = new JSONObject();
            xgDataJson.put("PERNR", gh);
            JSONArray P0002List = new JSONArray();
            JSONObject P0002Json = new JSONObject();
            P0002Json.put("BEGDA", hcmUtil.formatDate(csrq));
            P0002Json.put("ENDDA", "99991231");
            P0002Json.put("NACHN", x);
            P0002Json.put("VORNA", m);
            P0002Json.put("GESCH", xb);
            P0002Json.put("GBDAT", hcmUtil.formatDate(csrq));
            P0002Json.put("NATIO", gjbm);
            P0002Json.put("FAMST", hyzk);
            P0002Json.put("ZZHUKOT", hkxz);
            P0002Json.put("ZZMZ", mz);
            P0002Json.put("ZZJG", jg);
            P0002Json.put("ZZCSD", csd);
            P0002Json.put("ZZJKZK", jkzk);
            P0002Json.put("ZZRSDA", rsdaszd);
            if (!"0".equals(zhdxzhzt)) {
                P0002Json.put("ZZSFZH", zhdxzhzt);
            }
            P0002Json.put("ACTION", "U");
            P0002List.add(P0002Json);
            xgDataJson.put("P0002", P0002List);
            JSONArray P0006List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt12 where mainid=?", mainid);
            while (rs.next()) {
                String dzlx = Util.null2String(rs.getString("dzlx"));
                String province = Util.null2String(rs.getString("province"));
                String city = Util.null2String(rs.getString("city"));
                String qx = Util.null2String(rs.getString("qx"));
                String xxdz = Util.null2String(rs.getString("xxdz"));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                JSONObject P0006Json = new JSONObject();
                P0006Json.put("BEGDA", dbdwsj);
                P0006Json.put("ENDDA", "99991231");
                P0006Json.put("ANSSA", dzlx);
                P0006Json.put("ZHR_SF", province);
                P0006Json.put("ZHR_CS", city);
                P0006Json.put("ZHR_QX", qx);
                P0006Json.put("STRAS", xxdz);
                P0006Json.put("ZHGUID", guid);
                P0006Json.put("ACTION", action);
                P0006List.add(P0006Json);
            }
            if(!"".equals(guid12)){
                String [] arr12 = guid12.split(",");
                for (String guid : arr12) {
                    JSONObject P0006Json = new JSONObject();
                    P0006Json.put("ZHGUID", guid);
                    P0006Json.put("ACTION", "D");
                    P0006List.add(P0006Json);
                }
            }
            xgDataJson.put("P0006", P0006List);
            JSONArray P0009List = new JSONArray();
            JSONArray P0041List = new JSONArray();
            JSONArray P0105List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt14 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P0009Json = new JSONObject();
                P0009Json.put("BEGDA", dbdwsj);
                P0009Json.put("ENDDA", "99991231");
                P0009Json.put("BANKS", Util.null2String(rs.getString("yxgjbm")));
                P0009Json.put("BANKL", Util.null2String(rs.getString("yxdm")));
                String yxzh = Util.null2String(rs.getString("yxzh"));
                P0009Json.put("BANKN", yxzh.length()<=18 ? yxzh : yxzh.substring(0,18));
                P0009Json.put("BKREF", yxzh.length()<=18 ? "" : yxzh.substring(18));
                P0009Json.put("ZLSCH", "T");
                P0009Json.put("BNKSA", "0");
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P0009Json.put("ZHGUID", guid);
                P0009Json.put("ACTION", action);
                P0009List.add(P0009Json);
            }
            if(!"".equals(guid14)){
                String [] arr14 = guid14.split(",");
                for (String guid : arr14) {
                    JSONObject P0009Json = new JSONObject();
                    P0009Json.put("ZHGUID", guid);
                    P0009Json.put("ACTION", "D");
                    P0009List.add(P0009Json);
                }
            }
            xgDataJson.put("P0009", P0009List);
            JSONObject P0041Json = new JSONObject();
            P0041Json.put("BEGDA", dbdwsj);
            P0041Json.put("ENDDA", "99991231");
            P0041Json.put("DAR05", "Z5");
            P0041Json.put("DAT05", hcmUtil.formatDate(sccbsj));
            P0041Json.put("DAR07", "Z7");
            P0041Json.put("DAT07", hcmUtil.formatDate(rzhtxsj));
            P0041Json.put("ACTION", "U");
            P0041List.add(P0041Json);
            xgDataJson.put("P0041", P0041List);
            if (!"".equals(sjhm1)) {
                JSONObject P0105Json = new JSONObject();
                P0105Json.put("BEGDA", dbdwsj);
                P0105Json.put("ENDDA", "99991231");
                P0105Json.put("USRTY", "9001");
                P0105Json.put("USRID", sjhm1);
                P0105Json.put("ZHGUID", hcmUtil.getUUIDStr());
                P0105Json.put("ACTION", "U");
                P0105List.add(P0105Json);
            }
            if (!"".equals(sjhm2)) {
                JSONObject P0105Json = new JSONObject();
                P0105Json.put("BEGDA", dbdwsj);
                P0105Json.put("ENDDA", "99991231");
                P0105Json.put("USRTY", "9002");
                P0105Json.put("USRID", sjhm2);
                P0105Json.put("ZHGUID", hcmUtil.getUUIDStr());
                P0105Json.put("ACTION", "U");
                P0105List.add(P0105Json);
            }
            if (!"".equals(dzyx)) {
                JSONObject P0105Json = new JSONObject();
                P0105Json.put("BEGDA", dbdwsj);
                P0105Json.put("ENDDA", "99991231");
                P0105Json.put("USRTY", "9008");
                P0105Json.put("USRID", dzyx);
                P0105Json.put("ZHGUID", hcmUtil.getUUIDStr());
                P0105Json.put("ACTION", "U");
                P0105List.add(P0105Json);
            }
            xgDataJson.put("P0105", P0105List);
            JSONArray P0534List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt1 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P0534Json = new JSONObject();
                P0534Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("cjdprq"))));
                P0534Json.put("ENDDA", "99991231");
                P0534Json.put("PCODE", Util.null2String(rs.getString("zzmm")));
                String zzgxsfzzhtxn = Util.null2String(rs.getString("zzgxsfzzhtxn"));
                if("1".equals(zzgxsfzzhtxn)){
                    P0534Json.put("ZZGXDW","X");
                }

                P0534Json.put("ZZDPZZ", hcmUtil.formatDate(Util.null2String(rs.getString("dpzzrq"))));
                P0534Json.put("ZZDPSZDW", Util.null2String(rs.getString("cjdpsszdw")));
                P0534Json.put("ZZJSR", Util.null2String(rs.getString("jsr")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P0534Json.put("ZHGUID", guid);
                P0534Json.put("ACTION", action);
                P0534List.add(P0534Json);
            }
            if(!"".equals(guid1)){
                String [] arr1 = guid1.split(",");
                for (String guid : arr1) {
                    JSONObject P0534Json = new JSONObject();
                    P0534Json.put("ZHGUID", guid);
                    P0534Json.put("ACTION", "D");
                    P0534List.add(P0534Json);
                }
            }
            xgDataJson.put("P0534", P0534List);
            JSONArray P0021List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt2 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P0021Json = new JSONObject();
                P0021Json.put("BEGDA", dbdwsj);
                P0021Json.put("ENDDA", "99991231");
                P0021Json.put("SUBTY", Util.null2String(rs.getString("ybrdgx")));
                P0021Json.put("FANAM", Util.null2String(rs.getString("x")));
                P0021Json.put("FAVOR", Util.null2String(rs.getString("m")));
                // P0021Json.put("FASEX", Util.null2String(rs.getString("xb")));
                P0021Json.put("FGBDT", hcmUtil.formatDate(Util.null2String(rs.getString("cycsrq"))));
                P0021Json.put("ZZGZDW", Util.null2String(rs.getString("gzdw")));
                P0021Json.put("ZZGW", Util.null2String(rs.getString("zwzw")));
                P0021Json.put("ZZPCODE", Util.null2String(rs.getString("zzmm")));
                P0021Json.put("ZZTELNR", Util.null2String(rs.getString("lxdh")));
                String jjlxr = Util.null2String(rs.getString("jjlxr"));
                if ("0".equals(jjlxr)) {
                    P0021Json.put("ZHR_JJLXR", "X");
                }
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P0021Json.put("ZHGUID", guid);
                P0021Json.put("ACTION", action);
                P0021List.add(P0021Json);
            }
            if(!"".equals(guid2)){
                String [] arr2 = guid2.split(",");
                for (String guid : arr2) {
                    JSONObject P0021Json = new JSONObject();
                    P0021Json.put("ZHGUID", guid);
                    P0021Json.put("ACTION", "D");
                    P0021List.add(P0021Json);
                }
            }
            xgDataJson.put("P0021", P0021List);
            JSONArray P0185List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt13 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P0185Json = new JSONObject();
                P0185Json.put("BEGDA", dbdwsj);
                P0185Json.put("ENDDA", "99991231");
                P0185Json.put("ICTYP", Util.null2String(rs.getString("zjlb")));
                P0185Json.put("ICNUM", Util.null2String(rs.getString("zjbh")));
                P0185Json.put("USEFR", hcmUtil.formatDate(Util.null2String(rs.getString("syksrq"))));
                P0185Json.put("USETO", hcmUtil.formatDate(Util.null2String(rs.getString("syjsrq"))));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P0185Json.put("ZHGUID", guid);
                P0185Json.put("ACTION", action);
                P0185List.add(P0185Json);
            }
            if(!"".equals(guid13)){
                String [] arr13 = guid13.split(",");
                for (String guid : arr13) {
                    JSONObject P0185Json = new JSONObject();
                    P0185Json.put("ZHGUID", guid);
                    P0185Json.put("ACTION", "D");
                    P0185List.add(P0185Json);
                }
            }
            xgDataJson.put("P0185", P0185List);
            JSONArray P9520List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt3 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9520Json = new JSONObject();
                P9520Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("rxsj"))));
                P9520Json.put("ENDDA", hcmUtil.formatDate(Util.null2String(rs.getString("bysj"))));
                P9520Json.put("ZZZXL", Util.null2String(rs.getString("xl")));
                P9520Json.put("ZZXXFS", Util.null2String(rs.getString("xlxs")));
                P9520Json.put("ZZYXMC", Util.null2String(rs.getString("yxmc")));
                P9520Json.put("ZZYDL", Util.null2String(rs.getString("zylb")));
                P9520Json.put("ZZYMC", Util.null2String(rs.getString("sxzy")));
                P9520Json.put("ZZZXW", Util.null2String(rs.getString("xw")));
                P9520Json.put("ZZXLZS", Util.null2String(rs.getString("xlzsbh")));
                P9520Json.put("ZZXWZS", Util.null2String(rs.getString("xwzsbh")));
                P9520Json.put("ZZZXZ", Util.null2String(rs.getString("xzn")));
                P9520Json.put("ZZSFXX", Util.null2String(rs.getString("sf985211")));
                P9520Json.put("ZHR_BYRQ", hcmUtil.formatDate(Util.null2String(rs.getString("bysj"))));
                String sfzgxl = Util.null2String(rs.getString("sfzgxl"));
                if ("1".equals(sfzgxl)) {
                    P9520Json.put("ZZGXL", "X");
                }
                String sfzgxw = Util.null2String(rs.getString("sfzgxw"));
                if ("1".equals(sfzgxw)) {
                    P9520Json.put("ZZGXW", "X");
                }
                String sfdyxl = Util.null2String(rs.getString("sfdyxl"));
                if ("1".equals(sfdyxl)) {
                    P9520Json.put("ZZDYXL", "X");
                }
                String sflx = Util.null2String(rs.getString("sflx"));
                if ("1".equals(sflx)) {
                    P9520Json.put("ZZSFLX", "X");
                }
                //String sf985211 = Util.null2String(rs.getString("sf985211"));
                //if ("2".equals(sf985211) || "3".equals(sf985211)) {
                //    P9520Json.put("ZZSFXX", "X");
                //}
                String xxxs = Util.null2String(rs.getString("xxxs"));
                P9520Json.put("ZZHDQD", xxxs);
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9520Json.put("ZHGUID", guid);
                P9520Json.put("ACTION", action);
                P9520List.add(P9520Json);
            }
            if(!"".equals(guid3)){
                String [] arr3 = guid3.split(",");
                for (String guid : arr3) {
                    JSONObject P9520Json = new JSONObject();
                    P9520Json.put("ZHGUID", guid);
                    P9520Json.put("ACTION", "D");
                    P9520List.add(P9520Json);
                }
            }
            xgDataJson.put("P9520", P9520List);
            JSONArray P9502List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt7 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9502Json = new JSONObject();
                P9502Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("hjsj"))));
                P9502Json.put("ENDDA", "99991231");
                P9502Json.put("ZZHJMC", Util.null2String(rs.getString("hjmc")));
                P9502Json.put("ZZJLLB", Util.null2String(rs.getString("jllb")));
                P9502Json.put("ZZJLJB", Util.null2String(rs.getString("jljb")));
                P9502Json.put("ZZJLLX", Util.null2String(rs.getString("jllx")));
                P9502Json.put("ZZBFDW", Util.null2String(rs.getString("sjjg")));
                P9502Json.put("ZZJLYY", Util.null2String(rs.getString("jlyy")));
                P9502Json.put("ZZFWWH", Util.null2String(rs.getString("fwwh")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9502Json.put("ZHGUID", guid);
                P9502Json.put("ACTION", action);
                P9502List.add(P9502Json);
            }
            if(!"".equals(guid7)){
                String [] arr7 = guid7.split(",");
                for (String guid : arr7) {
                    JSONObject P9502Json = new JSONObject();
                    P9502Json.put("ZHGUID", guid);
                    P9502Json.put("ACTION", "D");
                    P9502List.add(P9502Json);
                }
            }
            xgDataJson.put("P9502", P9502List);
            JSONArray P9509List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt8 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9509Json = new JSONObject();
                P9509Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("qdzgsj"))));
                P9509Json.put("ENDDA", "99991231");
                P9509Json.put("ZZYLB", Util.null2String(rs.getString("zylb")));
                P9509Json.put("ZZCXL", Util.null2String(rs.getString("zyfl")));
                P9509Json.put("ZZYZG", Util.null2String(rs.getString("zyjszwrzzgmc")));
                P9509Json.put("ZZGJB", Util.null2String(rs.getString("zyjsjb")));
                P9509Json.put("ZZGBWH", Util.null2String(rs.getString("gbzgwh")));
                P9509Json.put("ZZPSDW", Util.null2String(rs.getString("zgpsdw")));
                P9509Json.put("ZZHDTJ", Util.null2String(rs.getString("qdzgtj")));
                String sfzgzc = Util.null2String(rs.getString("sfzgzc"));
                if ("0".equals(sfzgzc)) {
                    P9509Json.put("ZZSFZGZC", "X");
                }
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9509Json.put("ZHGUID", guid);
                P9509Json.put("ACTION", action);
                P9509List.add(P9509Json);
            }
            if(!"".equals(guid8)){
                String [] arr8 = guid8.split(",");
                for (String guid : arr8) {
                    JSONObject P9509Json = new JSONObject();
                    P9509Json.put("ZHGUID", guid);
                    P9509Json.put("ACTION", "D");
                    P9509List.add(P9509Json);
                }
            }
            xgDataJson.put("P9509", P9509List);
            JSONArray P9516List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt5 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9516Json = new JSONObject();
                P9516Json.put("BEGDA", dbdwsj);
                P9516Json.put("ENDDA", "99991231");
                P9516Json.put("ZZSYZ", Util.null2String(rs.getString("zsyz")));
                P9516Json.put("ZHR_YYZS", Util.null2String(rs.getString("yyzs")));
                P9516Json.put("ZZSLCD", Util.null2String(rs.getString("yydj")));
                //P9516Json.put("ZZSMC", Util.null2String(rs.getString("zsmc")));
                P9516Json.put("ZHR_SLCD", Util.null2String(rs.getString("slcd")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9516Json.put("ZHGUID", guid);
                P9516Json.put("ACTION", action);
                P9516List.add(P9516Json);
            }
            if(!"".equals(guid5)){
                String [] arr5 = guid5.split(",");
                for (String guid : arr5) {
                    JSONObject P9516Json = new JSONObject();
                    P9516Json.put("ZHGUID", guid);
                    P9516Json.put("ACTION", "D");
                    P9516List.add(P9516Json);
                }
            }
            xgDataJson.put("P9516", P9516List);
            JSONArray P9510List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt9 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9510Json = new JSONObject();
                P9510Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("qdzgdrq"))));
                P9510Json.put("ENDDA", "99991231");
                P9510Json.put("ZZGMC", Util.null2String(rs.getString("zzyzgmc")));
                P9510Json.put("ZZGBZGWH", Util.null2String(rs.getString("gbzgwjh")));
                P9510Json.put("ZZHFDW", Util.null2String(rs.getString("zshfdwmc")));
                P9510Json.put("ZZZGDJ", Util.null2String(rs.getString("zgdj")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9510Json.put("ZHGUID", guid);
                P9510Json.put("ACTION", action);
                P9510List.add(P9510Json);
            }
            if(!"".equals(guid9)){
                String [] arr9 = guid9.split(",");
                for (String guid : arr9) {
                    JSONObject P9510Json = new JSONObject();
                    P9510Json.put("ZHGUID", guid);
                    P9510Json.put("ACTION", "D");
                    P9510List.add(P9510Json);
                }
            }
            xgDataJson.put("P9510", P9510List);
            JSONArray P9521List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt4 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9521Json = new JSONObject();
                P9521Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("kssj"))));
                P9521Json.put("ENDDA", hcmUtil.formatDate(Util.null2String(rs.getString("jssj"))));
                P9521Json.put("ZGZDW", Util.null2String(rs.getString("gzdw")));
                P9521Json.put("ZGZBM", Util.null2String(rs.getString("bm")));
                P9521Json.put("ZGZZW", Util.null2String(rs.getString("zwzw")));
                P9521Json.put("ZGZZM", Util.null2String(rs.getString("zmr")));
                P9521Json.put("ZZMDH", Util.null2String(rs.getString("lxdh")));
                P9521Json.put("ZHR_GZLL", Util.null2String(rs.getString("gzjllx")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9521Json.put("ZHGUID", guid);
                P9521Json.put("ACTION", action);
                P9521List.add(P9521Json);
            }
            if(!"".equals(guid4)){
                String [] arr4 = guid4.split(",");
                for (String guid : arr4) {
                    JSONObject P9521Json = new JSONObject();
                    P9521Json.put("ZHGUID", guid);
                    P9521Json.put("ACTION", "D");
                    P9521List.add(P9521Json);
                }
            }
            xgDataJson.put("P9521", P9521List);
            JSONArray P9532List = new JSONArray();
            rs.executeQuery("select * from " + tablename + "_dt15 where mainid=?", mainid);
            while (rs.next()) {
                JSONObject P9532Json = new JSONObject();
                P9532Json.put("BEGDA", hcmUtil.formatDate(Util.null2String(rs.getString("ksrq"))));
                P9532Json.put("ENDDA", "99991231");
                P9532Json.put("ZZSCLXTCL", Util.null2String(rs.getString("sclx")));
                P9532Json.put("ZZCJLBTCL", Util.null2String(rs.getString("sclb")));
                P9532Json.put("ZZZCDJTCL", Util.null2String(rs.getString("cjdj")));
                P9532Json.put("ZZCJZHTCL", Util.null2String(rs.getString("cjrzh")));
                P9532Json.put("ZZBWCDTCL", Util.null2String(rs.getString("bz")));
                String guid = Util.null2String(rs.getString("guid"));
                String action = "U";
                if("".equals(guid)){
                    guid = hcmUtil.getUUIDStr();
                    action = "I";
                }
                P9532Json.put("ZHGUID", guid);
                P9532Json.put("ACTION", action);
                P9532List.add(P9532Json);
            }
            if(!"".equals(guid15)){
                String [] arr15 = guid15.split(",");
                for (String guid : arr15) {
                    JSONObject P9532Json = new JSONObject();
                    P9532Json.put("ZHGUID", guid);
                    P9532Json.put("ACTION", "D");
                    P9532List.add(P9532Json);
                }
            }
            xgDataJson.put("P9532", P9532List);
            xgDataList.add(xgDataJson);
            writeLog(">>>>>WeaYgxxzzwslcAction>>>>>xgDataList=" + xgDataList);
            Map<String, Object> dataMap = new HashMap<>();
            dataMap.put("jkdymc", "WeaYgxxzzwslcAction");
            dataMap.put("lcid", requestid);
            dataMap.put("dylc", requestid);
            dataMap.put("cz", src);
            JSONObject resultJson = hcmUtil.handleOKHttpRequest("EC206", xgDataList, dataMap);
            writeLog(">>>>>WeaYgxxzzwslcAction>>>>>resultJson=" + resultJson);
            String code = Util.null2String(resultJson.getString("code"));
            if ("success".equals(code)) {
                String output = Util.null2String(resultJson.getString("OUTPUT"));
                JSONObject outputJson = JSONObject.parseObject(output);
                String msgType = outputJson.getString("MSG_TYPE");
                if (!"S".equals(msgType)) {
                    message += outputJson.getString("MSG_TEXT");
                    requestInfo.getRequestManager().setMessageid("111111");
                    requestInfo.getRequestManager().setMessagecontent(message);
                    return Action.FAILURE_AND_CONTINUE;
                }
            } else {
                message += Util.null2String(resultJson.getString("message"));
                requestInfo.getRequestManager().setMessageid("111111");
                requestInfo.getRequestManager().setMessagecontent(message);
                return Action.FAILURE_AND_CONTINUE;
            }
            return Action.SUCCESS;
        } catch (Exception e) {
            writeLog(">>>>>WeaYgxxzzwslcAction>>>>>Exception=" + e);
            requestInfo.getRequestManager().setMessageid("111111");
            requestInfo.getRequestManager().setMessagecontent("Action接口处理异常,请联系管理员");
            return Action.FAILURE_AND_CONTINUE;
        }
    }
}